package org.example.mulitithreading.ex7;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.*;

public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(2);
        Data data = new Data();
        Future<Data> future = executorService.submit(new MyThread(data), data);
        System.out.println("返回的结果  name: " + future.get().getName()+", sex: "+future.get().getSex());
        System.out.println("原来的Data  name: " + data.getName()+", sex: "+data.getSex());
        executorService.shutdown();

    }
}
